//
//  UseLazyVGrid.swift
//  learn-ios
//
//  Created by Dong on 2022/4/5.
//

import SwiftUI

struct UseLazyVGrid: View {
    let columns: [GridItem] = Array(repeating: .init(.flexible(minimum: 10, maximum: 100)), count: 2)
    var body: some View {
        ScrollView {
            LazyVGrid(columns: columns, alignment: .center) {
                ForEach(1 ... 5, id: \.self) { _ in
                    Rectangle()
                        .frame(width: 100, height: 100, alignment: .center)
                }
            }
        }
    }
}

struct UseLazyVGrid_Previews: PreviewProvider {
    static var previews: some View {
        UseLazyVGrid()
    }
}
